package com.mdgafur.android_object_oriented_programming_AppPreferencesManager;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class AppPreferences {
	
	private static final String APP_SHARED_PREFS = "mypreferences"; //  Name of the file -.xml
    private SharedPreferences appSharedPrefs;
    private Editor prefsEditor;
    private Context context;

    public AppPreferences(Context context)
    {
    	this.context=context;
        this.appSharedPrefs = context.getSharedPreferences(APP_SHARED_PREFS, Context.MODE_PRIVATE);
        this.prefsEditor = appSharedPrefs.edit();
    }
    
    public boolean SetPassword(String password)
    {
    	 prefsEditor.putString("UsePassword", password);
         prefsEditor.commit();
         return true;
    }
    
    public String getPassword() {
        return appSharedPrefs.getString("UsePassword", "");
    }
}
